package com.chixing.day04_oop;


/*
* javaBean:(1)有无参构造函数 (2)有get、set方法
* */
public class Car {

        private int carId;
        private  String carName;

        private String carBrand;
        private  String carColor;


    //默认省略 无参构造函数
    public Car(){

    }
    //有构造函数 alt + insert
//如果已经定义了有参构造函数 则会把默认的无参构造函数覆盖 若还想使用 无参构造函数，则需要 显示的定义出来
    public Car(int carId,String carName){
        this.carId = carId;
        this.carName = carName;

    }
    public Car(int carId,String carName, String carBrand,String carColor){
        this(carId,carName);   //调用构造函数 必须放在第一行 在构造函数里面
        this.carBrand = carBrand;
        this.carColor = carColor;

    }

    public int getCarId() {
        return carId;
    }

    public void setCarId(int carId) {
        this.carId = carId;
    }

    public String getCarName() {
        return carName;
    }

    public void setCarName(String carName) {
        this.carName = carName;
    }

    public String getCarBrand() {
        return carBrand;
    }

    public void setCarBrand(String carBrand) {
        this.carBrand = carBrand;
    }

    public String getCarColor() {
        return carColor;
    }

    public void setCarColor(String carColor) {
        this.carColor = carColor;
    }
}
